package org.uim.cricket.entities.batting;


public enum OutTypes {

	DID_NOT_BAT(0, "DNB"),
	NOT_OUT(1, "notout"),
	RETIRED_HURT(2, "retired hurt"),
	LBW(3, "lbw"),
	BOWLED(4, "bowled"),
	COUGHT(5, "cought"),
	COUGHT_BY_KEEPER(6, "cought By Keeper"),
	COUGHT_BY_BOWLER(7, "cought and bowl"),
	STUMPED(8, "stumped"),
	RUNOUT(9, "runout"),
	HIT_WICKET(10, "hitwicket"),
	OBSTRUCT_ON_FIELD(11, "obstruction on field"),
	OTHER(99, "unknown");

	private final int index;
	private final String name;
	
	public OutTypes getFromStr(String type) {
		String src = type.toUpperCase().trim();
		if (src.equalsIgnoreCase("DID_NOT_BAT")) return OutTypes.DID_NOT_BAT;
		else if (src.equalsIgnoreCase("NOT_OUT")) return OutTypes.NOT_OUT;
		else if (src.equalsIgnoreCase("RETIRED_HURT")) return OutTypes.RETIRED_HURT;
		else if (src.equalsIgnoreCase("LBW")) return OutTypes.LBW;
		else if (src.equalsIgnoreCase("BOWLED")) return OutTypes.BOWLED;
		else if (src.equalsIgnoreCase("COUGHT")) return OutTypes.COUGHT;
		else if (src.equalsIgnoreCase("COUGHT_BY_KEEPER")) return OutTypes.COUGHT_BY_KEEPER;
		else if (src.equalsIgnoreCase("COUGHT_BY_BOWLER")) return OutTypes.COUGHT_BY_BOWLER;
		else if (src.equalsIgnoreCase("STUMPED")) return OutTypes.STUMPED;
		else if (src.equalsIgnoreCase("RUNOUT")) return OutTypes.RUNOUT;
		else if (src.equalsIgnoreCase("HIT_WICKET")) return OutTypes.HIT_WICKET;
		return OutTypes.OTHER;
	}
	
	OutTypes(int theIndex, String shortName) {
		index = theIndex;
		name = shortName;
	}
	
	public int getIndex() {
		return index;
	}
	
	public String getName() {
		return name;
	}
	
	
}
